﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyBanHang.GUI;

namespace QuanLyBanHang
{
    public partial class frmMain : Form
    {
        #region "Variables"
        public string _User;
        private int _Permiss;
        #endregion
        public frmMain()
        {
            InitializeComponent();
        }

        public frmMain(string _struser, int _Permission)
        {
            InitializeComponent();
            _User = _struser;
            _Permiss = _Permission;
        }
        private void sảnPhẩmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSanPham frmSP = new frmSanPham();
            frmSP.MdiParent = this;
            frmSP.WindowState = FormWindowState.Maximized;
            frmSP.Show();
        }

        private void nhómSảnPhẩmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmNhomSanPham frmNhomSP = new frmNhomSanPham();
            frmNhomSP.MdiParent = this;
            frmNhomSP.WindowState = FormWindowState.Maximized;
            frmNhomSP.Show();
        }

        private void kháchHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmKhachHang frmKH = new frmKhachHang();
            frmKH.MdiParent = this;
            frmKH.WindowState = FormWindowState.Maximized;
            frmKH.Show();
        }

        private void nhàCungCấpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmNhaCungCap frmNCC = new frmNhaCungCap();
            frmNCC.MdiParent = this;
            frmNCC.WindowState = FormWindowState.Maximized;
            frmNCC.Show();
        }

        private void quảnLýBánHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmBanHang frmBH = new frmBanHang(_User);
            frmBH.MdiParent = this;
            frmBH.WindowState = FormWindowState.Maximized;
            frmBH.Show();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            mnUser.Text = "Xin chào " + _User;
            if (_Permiss < 5)
            {
                mnstripDMKhachHang.Enabled = false;
                mnstripDMNhomSP.Enabled = false;
                mnstripDmNhaCC.Enabled = false;
                mnStripQtri.Enabled = false;
            }
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Dispose();
            frmLogin frm = new frmLogin();
            frm.Show();
            
        }

        private void đổiMậtKhẩuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmChangePass frmChange = new frmChangePass(_User);
            frmChange.Show();
        }

        private void nhómĐộTuổiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDoTuoi frmDT = new frmDoTuoi();
            frmDT.MdiParent = this;
            frmDT.WindowState = FormWindowState.Maximized;
            frmDT.Show();
        }

        private void khoSảnPhẩmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmKhoSanPham frmKho = new frmKhoSanPham();
            frmKho.MdiParent = this;
            frmKho.WindowState = FormWindowState.Maximized;
            frmKho.Show();
        }

        private void mnStripQtri_Click(object sender, EventArgs e)
        {
            frmQuantriUser frmUser = new frmQuantriUser();
            frmUser.MdiParent = this;
            frmUser.WindowState = FormWindowState.Maximized;
            frmUser.Show();
        }

        private void quảnLýHóaĐơnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmQLHoaDon frmQLHD = new frmQLHoaDon();
            frmQLHD.MdiParent = this;
            frmQLHD.WindowState = FormWindowState.Maximized;
            frmQLHD.Show();
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void quảnLýKhoSảnPhẩmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmKhoSanPham frmKho = new frmKhoSanPham();
            frmKho.MdiParent = this;
            frmKho.WindowState = FormWindowState.Maximized;
            frmKho.Show();
        }

        private void lậpPhiếuNhậpKhoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPhieuNhapHang frmNhap = new frmPhieuNhapHang(_User);
            frmNhap.MdiParent = this;
            frmNhap.WindowState = FormWindowState.Maximized;
            frmNhap.Show();
        }
    }
}
